package com.jt.resource.controller;

import com.jt.feign.RemoteProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 金帮嘉诚 @date 2021-08-18 星期三 10:34
 * 四种远程请求方式
 * 其中三种负载均衡方式 底层都是用的ribbon进行负载均衡
 */
@RestController
@RequestMapping("/feign")
public class FeignConsumerController {
    @Autowired
    private RemoteProviderService remoteProviderService;

    @GetMapping("/echo/{msg}")
    public String doFeignEcho(@PathVariable("msg") String msg) {
        //HttpClient -> RestTemplate
        //OkHttp ->feign
        return remoteProviderService.echoMsg(msg);
    }
}
